import datetime
import os
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Edge()
# 我的第二屏幕在左侧，所以向左移动1920px,根据屏幕分辨率来计算
second_screen_x = -1920
second_screen_y = 0
driver.set_window_position(second_screen_x, second_screen_y)
driver.maximize_window()
driver.get("https://new-www.test.ybm100.com/new/")
driver.find_element(By.CSS_SELECTOR, "input.el-input__inner[type='text']").send_keys("13567892345")
driver.find_element(By.CSS_SELECTOR, "input.el-input__inner[type='password']").send_keys("a1234567")
driver.find_element(By.CSS_SELECTOR, "span.el-checkbox__input").click()
driver.find_element(By.CSS_SELECTOR, "button.el-button.login-button").click()
driver.implicitly_wait(2)
# driver.find_element(By.CSS_SELECTOR, "#app > div > div.shopWrapper > div.shopListBox > div:nth-child(1)").click()
driver.find_element(By.CSS_SELECTOR, "#app > div > div.micro-head-wrap > div > div:nth-child(1) > div > span")
driver.implicitly_wait(2)
# 添加屏幕截图
# 图片名
filename = "药帮忙测试-"+datetime.datetime.now().strftime('%Y-%m-%d-%H%M%S')+'.png'
# 添加截图路径
screenshot_path = os.path.join('images', filename)
driver.save_screenshot(screenshot_path)
driver.quit()





